#ifndef _GEO_TIFF_READER_HXX_
#define _GEO_TIFF_READER_HXX_

extern "C"
{
#include <tiffconf.h>
#include <tiffio.h>
}

#include "GeoTiffImage.hxx"

class GeoTiffReader
{
public:
	GeoTiffReader();
	~GeoTiffReader();
	
	void readImage();

	inline void setGeoTiffFileName(const char* fileName) { strcpy(_fileName, fileName); }
	inline char* getGeoTiffFileName() { return _fileName; }

	inline void setGeoTiffImage(GeoTiffImage* image) { _geoTiffImage = image; }
	inline GeoTiffImage* getGeoTiffImage() { return _geoTiffImage; }

	inline void setJustReadHeader() { _justReadHeader = true;  }
	inline bool isJustReadHeader() { return _justReadHeader; }

private:
	void readHeader(TIFF* tif);
	void readData(TIFF* tif);
	
	void splitData(TIFF* tif);
	void extractMaxMinValue();

private:
	GeoTiffImage* _geoTiffImage;
	char _fileName[256];

	bool _justReadHeader;
};
#endif
